package com.collection;

import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.beanutils.BeanUtils;

public class ListModify {
	private static List<User> users = new ArrayList<>();

	static {
		users.add(new User("lihh", 25));
		users.add(new User("lihhz", 26));
		users.add(new User("lihuanhuan", 28));
	}

	public static void main(String[] args) throws IllegalAccessException, InvocationTargetException {
		for (int i = 0; i < users.size(); i++) {
			if (users.get(i).getAge() == 26) {
				BeanUtils.copyProperties(users.get(i), new User("aaaa",100));
			}
		}
		for (int i = 0; i < users.size(); i++) {
			System.out.println(users.get(i));
		}
	}

}
